package lumis.service.pagepersonalization.widgetmanipulationaction;

import lumis.portal.PortalException;
import lumis.portal.presentation.perspective.IPortalMode;
import lumis.portal.transaction.ITransaction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Interface that must be implemented by classes responsible for manipulating
 * user widgets.
 *
 * @version $Revision: 13092 $ $Date: 2011-05-28 18:19:06 -0300 (Sat, 28 May 2011) $
 * @since 6.0.0
 */
public interface WidgetManipulationAction
{
	/**
	 * Performs necessary widget manipulation. Must return a
	 * {@link HttpServletResponse#setStatus(int) HTTP status code} to indicate
	 * if it was succeeded or not. It is not responsible of implementing classes
	 * to {@link ITransaction#rollback() rollback} or
	 * {@link ITransaction#dispose() dispose} the transaction. If the return
	 * code is different from {@link HttpServletResponse#SC_OK}, the caller will
	 * do the {@link ITransaction#rollback() rollback} automatically.
	 *
	 * @param request
	 *            the HTTP servlet request.
	 * @param portalMode the current portal mode.
	 * @param transaction
	 *            the transaction to be used.
	 * @return an HTTP status code.
	 * @since 6.0.0
	 */
	public int doAction(HttpServletRequest request, IPortalMode portalMode, ITransaction transaction) throws PortalException;
}
